export default {
    namespaced: true,
    state:{
        id: '',
        title: '',
        description: '',
        uploadDate: '',
        uploader: '',
        channelId: '',
        thumbnail: '#',
        channelUrl: '',
        formats: [],
        loaded: false,
        errorMessage: '',
    },
    getters:{
        data( state ){
            return {
                id: state.id,
                title: state.title,
                description: state.description,
                uploadDate: state.uploadDate,
                uploader: state.uploader,
                channelId: state.channelId,
                thumbnail: state.thumbnail,
                channelUrl: state.channelUrl,
                loaded: state.loaded,
                formats: state.formats,
                errorMessage: state.errorMessage
            }
        }
    },
    mutations:{
        setData( state, data ){
            state.id = data.id;
            state.title = data.title;
            state.description = data.description;
            state.uploadDate = data.uploadDate;
            state.uploader = data.uploader;
            state.channelId = data.channelId;
            state.thumbnail = data.thumbnail;
            state.channelUrl = data.channelUrl;
            state.formats = data.formats;
        },
        setId(state, id) {
            state.id = id;
        },
        setLoaded(state, loaded) {
            state.loaded = loaded;
        },
        setErrorMessage(state, message) {
            state.errorMessage = message;
        }
    }
}